<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.trkj.com/tr1702/tags" prefix="my" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定义技能</title>
	<style type="text/css">
		 
	</style>
</head>
<body>
<script type="text/javascript">
			var formatters1 = function(value,row,index){
				<my:g id="87"> 
				var del ="<a butn='tb_btn_del' onclick='delrow("+row.skillId+")'></a>";
				</my:g> 
				return del;
			}
			var delrow= function(skillId){
				$.messager.confirm('提示','确定删除该项',function(v){
					if(v){
						$.post('delete_skill',{skillId:skillId},function(){
							$('#cf-defineskill-tb').datagrid('reload');
						});
					}
				});
			}
			var savedialog = function(){
				<my:g id="86"> 
				$("<form method='get'>").appendTo(document.body).form({
					url:'update_skill',
					onSubmit:function(param){
						var vv=$('#cf-defineskill-tb').datagrid('getSelected');
						//alert(vv.positionId);
						param['skillId'] =vv.skillId;
						param['skillName'] = $("#cf-defineskill-name").textbox('getValue');
						param['skillRemark'] =$("#cf-defineskill-remark").textbox('getValue');
					},
					success:function(){
						$('#cf-defineskill-tb').datagrid('reload');
						$('#cf-defineskill-win').dialog('close');
					}
				}).submit().appendTo(".abc");
				</my:g> 
			}
			$(function(){
				$("#cf-defineskill-tb").datagrid({onLoadSuccess: function(){
					$("a[butn=tb_btn_edit]").linkbutton({iconCls:'icon-edit', plain:true});
					$("a[butn=tb_btn_del]").linkbutton({iconCls:'icon-cancel', plain:true});
				}});
				$('#cf-defineskill-refresh').linkbutton({onClick: function(){
					$('#cf-defineskill-tb').datagrid('reload');
				}});
				$("#cf-defineskill-add").linkbutton({
					onClick : function() {
						$("#cf-defineskill-win").dialog("open");
						$("#cf-defineskill-f").form('clear');
						/* parent.$('.dialog-button a:eq(1)').hide();
						parent.$('.dialog-button a:eq(0)').show(); */
						$('#cf-dyjn-2').hide();
						$('#cf-dyjn-1').show();
						$("#cf-defineskill-ids").textbox("enable");
					}
				});
				$("#cf-defineskill-tb").datagrid({onDblClickRow:function(){
					var vv=$('#cf-defineskill-tb').datagrid('getSelected');
					$("#cf-defineskill-win").dialog("open");
					$("#cf-defineskill-ids").textbox('setValue',vv.skillId);
					$("#cf-defineskill-name").textbox('setValue',vv.skillName);
					$("#cf-defineskill-remark").textbox('setValue',vv.skillRemark);
					/* parent.$('.dialog-button a:eq(1)').show();
					parent.$('.dialog-button a:eq(0)').hide(); */
					$('#cf-dyjn-1').hide();
					$('#cf-dyjn-2').show();
					$("#cf-defineskill-ids").textbox("disable");
				}});
			});
	</script>
	<div class="abc"></div>
	<div id="cf-defineskill-tbs7">
		<my:g id="85"> 
   		 <a id="cf-defineskill-add" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a>
    	 </my:g>
			<a id="cf-defineskill-refresh" class="easyui-linkbutton" data-options="iconCls:'icon-reload',text:'刷新',plain:true,iconAlign:'right'"></a> 
		<input class="easyui-searchbox" data-options="label:'搜索',width:300,labelWidth:50,prompt:'技能名称',
     	searcher:function(value,name){
	        $('#cf-defineskill-tb').datagrid('load','modaddSeslect_skill?text='+value);
     	 }">
  </div>
		<table id="cf-defineskill-tb" class="easyui-datagrid" data-options="
			url:'queryByto_skill',
			fitColumns:true,
			fit:true,
			nowrap:false,
			loading:true,
			pagination:true,
			rownumbers:true,
			singleSelect:true,
			pageSize:10,
    		pageList:[10,20,30,40,50],
			toolbar:'#cf-defineskill-tbs7',
			striped:true,
			method:'get'	
	">
		<thead>
		  <tr>
			<th data-options="field:'skillId',width:200,align:'center'">技能编号</th>
			<th data-options="field:'skillName',width:200,align:'center'">技能名称</th>
			<th data-options="field:'skillRemark',width:400,align:'center'">备注</th>
			<th data-options="field:'skillCreatordate',width:200,align:'center',
				formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
			}">创建日期</th>
			<th data-options="field:'skillUpdatedate',width:200,align:'center',
				formatter:function(value,row,index){
							var date = new Date(value);
							return date.toLocaleString();
			}">最后更新时间</th>
			<th data-options="field:'4',width:80,align:'center',formatter:formatters1">删除</th>
		  </tr>	
		</thead>
		<tbody>
			 
		</tbody>
	</table>
<div id="cf-defineskill-win" class="easyui-dialog"data-options="width:400, height:220,
			title:'用户注册',
     		bodyCls:'insert_skill',
      		modal:true,
      		closed:true,
      		buttons:[{
	        	text:'提交',
				id:'cf-dyjn-1',
	        	iconCls:'icon-ok',
        		handler:function(){
          		 $('#cf-defineskill-f').form({
            		onSubmit:function(param){
            		 //验证表单
						var cc=$('#cf-defineskill-ids').textbox('getValue');
             		 return $(this).form('validate');
            		},
	           		 success:function(v){
	              		//$.messager.alert('提示','注册成功');
	              		$('#cf-defineskill-tb').datagrid('reload');
						$('#cf-defineskill-win').dialog('close');
	            	}
          	    }).submit();
       		  }
      		},{
        	text:'保存',
			id:'cf-dyjn-2',
        	iconCls:'icon-save',
        	handler:savedialog
			},{
        	text:'取消',
        	iconCls:'icon-cancel',
        	handler:function(){
          		$('#cf-defineskill-win').dialog('close');
        	}
			}
			]">
		<form id="cf-defineskill-f" action="insert_skill" method="post">
			<div class="line">
				        <input id="cf-defineskill-ids" class="easyui-textbox" name="skillId"
					data-options="label:'技能编号',width:250">
			</div>
			
			<div class="line">
				        <input id="cf-defineskill-name" class="easyui-textbox" name="skillName"
					data-options="label:'技能名称',width:250">
			</div>
			 
			<div class="line">
				        <input id="cf-defineskill-remark" class="easyui-textbox" name="skillRemark"
					data-options="label:'备注',width:350,multiline:true
					,height:70">
			</div>
			
		</form>
	</div>

</body>
</html>